{include file="public/_meta" title="修改接口"/}
<article class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-api-edit">
		<input type="hidden" class="input-text" value="{$api['id']}" placeholder=""  name="id">
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>接口名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$api['api_name']}" placeholder=""  name="api_name">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>接口地址：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$api['api_url']}" placeholder="如：api/index/index"  name="api_url">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>请求类型：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$api['request_type']}" placeholder="如：post、get、put、delete"  name="request_type">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>路由类型：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$api['route_type']}" placeholder="如：普通模式、路由模式"  name="route_type">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>加密串：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea type="text" class="textarea" placeholder="" name="aes_code">{$api['aes_code']}</textarea>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>接口参数：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea type="text" class="textarea" placeholder="" name="api_param">{$api['api_param']}</textarea>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>返回数据：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea type="text" class="textarea" value="" placeholder="" name="return_data">{$api['return_data']}</textarea>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-9 col-sm-10 col-xs-offset-3 col-sm-offset-2">
				<button type="submit" class="btn btn-success radius" id="api-add"><i class="icon-ok"></i> 修改</button>
				<button onClick="parent.layer.close(parent.layer.getFrameIndex(window.name));" class="btn btn-success size-M radius" type="button">取消</button>
			</div>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
{include file="public/_footer" /}
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->

<script type="text/javascript">
	
	$("#form-api-edit").validate({
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			var data = $(form).serializeArray();
			$(form).ajaxSubmit({
				type: 'post',
				url: "{:url('api/edit_api')}",
				dataType: 'json',
				data: data,
				success: function(msg){
				    if(msg.status == true){
                        layer.msg(msg.message,{icon: 6,time:1000});
                        setTimeout(jump,1000);
                        function jump(){
                            parent.location.reload();
                        }
					}else if(msg.status == false){
                        layer.msg(msg.message,{icon: 5,time:2000});
					}
				}
			});
		}
	});

</script>

<!--/请在上方写此页面业务相关的脚本-->
